package org.hxyjs.dao.impl;

import org.hxyjs.dao.OperatingrecordDao;
import org.hxyjs.entity.Operatingrecord;
import org.hxyjs.mapper.OperatingrecordMapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Repository("operatingrecordDao")//一般实现类不会直接生成默认对象名 而是使用 接口的默认对象名
public class OperatingrecordDaoImpl implements OperatingrecordDao {
    @Resource //autowired 会装配能够直接扫描到的对象  resource spring容器运行的时候才找到需要的对象  注入
    private OperatingrecordMapper operatingrecordMapper;
    public List<Operatingrecord>  getAllOperatingrecords() throws Exception{
        return operatingrecordMapper.selectByExample(null);
    }

    @Override
    public Integer deleteOperatingrecordByOrno(String orno)  throws Exception{
        return operatingrecordMapper.deleteByPrimaryKey(orno);
    }

    @Override
    public Integer updateOperatingrecordByOrno(Operatingrecord operatingrecord)  throws Exception{
        return operatingrecordMapper.updateByPrimaryKey(operatingrecord);
    }

    @Override
    public Integer addOperatingrecord(Operatingrecord operatingrecord)  throws Exception{
        return operatingrecordMapper.insertSelective(operatingrecord);
    }

}
